from models import Goal, Plan, PlanStatus
from django.contrib import admin

    
class PlanStatusInline(admin.StackedInline):
    model = PlanStatus
    extra = 2   

class PlanAdmin(admin.ModelAdmin):
    fields = ['description', 'deadline']
    inlines = [PlanStatusInline] 


class PlanInline(admin.StackedInline):
    model = Plan
    extra = 2
    
class GoalAdmin(admin.ModelAdmin):
    fieldsets = [
                 ('main',   {'fields':['title', 'user', 'deadline']}),
                 ('other',  {'fields':['description']}),
                 ]
    inlines = [PlanInline]
    
admin.site.register(Goal, GoalAdmin)
admin.site.register(Plan, PlanAdmin)